<?php
	!defined('DYHB_PATH') && exit;
	class ManageController extends InitController{
		function configure(){
			if($GLOBALS['___login___']==false){
				$this->assign('top','top');
				$this->E('此操作需要登陆后才能进行');
			}
			/*require(OFEBLOG_PATH.'/common/cache.php');*/
				$arrData=Dyhb::cache("option",'',array('cache_path'=>getcwd().'/data/~runtime/cache_'));
				if($arrData==false){
					require(OFEBLOG_PATH.'/common/cache.php');
					optionCache();
					$arrData=Dyhb::cache("option",'',array('cache_path'=>getcwd().'/data/~runtime/cache_'));
				}
				if($arrData['is_check']=='y'){
					$ext['is_checky']="selected=\"selected\"";
					$ext['is_checkn']="";
				}else{
					$ext['is_checky']="";
					$ext['is_checkn']="selected=\"selected\"";
				}
				if($arrData['login_code']=='y'){
					$ext['login_codey']="selected=\"selected\"";
					$ext['login_coden']="";
				}else{
					$ext['login_codey']="";
					$ext['login_coden']="selected=\"selected\"";
				}
				if($arrData['comment_code']=='y'){
					$ext['comment_codey']="selected=\"selected\"";
					$ext['comment_coden']="";
				}else{
					$ext['comment_codey']="";
					$ext['comment_coden']="selected=\"selected\"";
				}
				if($arrData['logup_code']=='y'){
					$ext['logup_codey']="selected=\"selected\"";
					$ext['logup_coden']="";
				}else{
					$ext['logup_codey']="";
					$ext['logup_coden']="selected=\"selected\"";
				}
			$this->assign('ext',$ext);
			$this->assign("arrData",$arrData);
			$this->display();
		}
		function personal(){
			if($GLOBALS['___login___']==false){
				$this->assign('top','top');
				$this->E('此操作需要登陆后才能进行');
			}
			$this->display();
		}
		function deal_blogset(){
			if($GLOBALS['___login___']==false){
				$this->assign('top','top');
				$this->E('此操作需要登陆后才能进行');
			}
			$sub=G::getGpc('sub','p');
			if(!empty($sub)){
				$arrFormData=G::getGpc('option','p');
				$arrErrorData=array();
				foreach($arrFormData as $key=>$value){
					$oOption=OptionModel::F('option_name=?',$key)->getOne();
					$oOption->option_value=$value;
					$oOption->save(0,'update');
					if($oOption->isError()){
						$arrErrorData[]=$oModel->getErrorMessage();
					}
				}
				//Dyhb::cache('option',null);
				require(OFEBLOG_PATH.'/common/cache.php');
				optionCache();
				if(empty($arrErrorData)){
					$this->assign('__JumpUrl__',Dyhb::U('Manage/configure'));
					$this->S('更新成功');
				}else{
					$this->E($arrErrorData);
				}
			}
		}
	}